
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'add.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/css.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.9.1.min.js"></script>
  </head>
  
  <body>

 <form action="change/huanfang.do" method="post" name="f1">
<input type="hidden" name="hid" value="${housepayment.id}">
<input type="hidden" name="rr" value="${room}">
 <table width="100%" border="0" cellpadding="0" cellspacing="1" class="ybox04table">
            <tr>
              <td class="ybox04tdr" colspan="9"><h6 style="color: red;">填写换房信息</h6></td>
              <td class="ybox04tdr"></td>
            </tr>
            <tr><td class="ybox04tdl"><span class="red">*</span> 原房间编号：</td>
              <td class="ybox04tdr"><input name="room" type="text" value="${room}"/></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
          </tr>
            
            <tr>
             <td  class="ybox04tdl"><span class="red">*</span> 应收金额：</td>
              <td  class="ybox04tdr"><input name="receivableoney" type="text" value="${housepayment.receivablemoney}" readonly="readonly"/></td>
             <td class="ybox04tdl"><span class="red">*</span> 未收金额：</td>
              <td class="ybox04tdr"><input name="uncollectedMoney" type="text" value="${housepayment.uncollectedmoney}" readonly="readonly"/></td>
              <td class="ybox04tdl"><span class="red">*</span> 已收金额：</td>
              <td class="ybox04tdr"><input name="accomplishMoney" type="text" value="${housepayment.accomplishmoney}" readonly="readonly"/></td>
            <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
              </tr>
              
              
          <tr>
            
              
               <td  class="ybox04tdl"><span class="red">*</span> 意向项目：</td>
              <td  class="ybox04tdr">
              <select name="project" id="project" onChange="change3()">
               <option value="">-------请选择--------</option>
               <c:forEach items="${list1}" var="p">
               <option value="${p.id}">------${p.name}---</option>
               </c:forEach>
               </select>
              </td>
              <td class="ybox04tdl"><span class="red">*</span> 意向楼栋：</td>
              <td class="ybox04tdr">
              
              <select name="complex" id="complex" onChange="change1()">
              <option value="">--------请选择-------</option>
               </select>
              
              </td>
              <td class="ybox04tdl"><span class="red">*</span> 意向单元：</td>
              <td class="ybox04tdr">
              <select name="unit" id="unit"  onchange="change2()">
              <option value="">--------请选择-------</option>
               </select>
              
              </td>
               <td class="ybox04tdl"><span class="red">*</span>意向房间：</td>
              <td class="ybox04tdr" style="width:20px">
               <select name="roomid" id="roomid">
              <option value="">--------请选择-------</option>
               </select>       
              </td>     
              <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
            </tr>
           
           
           
           
           <tr>
             <td  class="ybox04tdl"><span class="red">*</span> 新更换房间总价：</td>
              <td  class="ybox04tdr"><input name="xintotal" type="text" value="" readonly="readonly" onclick="change4()"/></td>
              <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
            
              <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
             <td  class="ybox04tdl"></td>
             <td  class="ybox04tdr"></td>
              </tr>
              
          
         
          <tr>
              <td  class="ybox04tdr"  colspan="10"><input type="button" onclick="tijiao()" value="提交"/>
               <input type="button" value="取消" onclick="end()"/>  </td>
            </tr>
          </table>
</form>

  </body>
  
</html>
<script>

	function end() {
		window.location.href = "housepayment/housepayment.do";
	}
	
	
	function change3(){
  				 var project=document.f1.project.value;
  				
	$.ajax({
			url : "marketing/toajax2.do",
			type : "post",
			dataType : "text",
			data : {project : project},
			success : function(requestXMLTest) {
			$("#complex").empty();
			  $("#complex").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	
	
	
function change1(){
   var complex=document.f1.complex.value;
  				
	$.ajax({
			url : "marketing/toajax3.do",
			type : "post",
			dataType : "text",
			data : {complex : complex},
			success : function(requestXMLTest) {
			
			$("#unit").empty();
			  $("#unit").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	function change2(){
   var unit=document.f1.unit.value;		
	$.ajax({
			url : "marketing/toajax4.do",
			type : "post",
			dataType : "text",
			data : {unit : unit},
			success : function(requestXMLTest) {
			$("#roomid").empty();
			  $("#roomid").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}	
	
	
	
	
	
	function tijiao() {
	
	    
	     var roomid=document.f1.roomid.value;
	      var xintotal=document.f1.xintotal.value;
	       var accomplishMoney=document.f1.accomplishMoney.value;
	  
	 
	   var c=xintotal-accomplishMoney;
	   if(roomid!=null && roomid!="" ){
	   
	     if(c>=0){
	   f1.submit();
	   }else{
	   
	   
	    alert("更换房间的总金额需大于已交金额");
	   
	   }
	   }else{
	   
	   
	    alert("请选择更换的房间");
	   
	   
	   }
	   
	   
	
		
	}
	
	
	
	
	function change4(){
  				 var roomid=document.f1.roomid.value;
  				
	$.ajax({
			url : "change/toajax.do",
			type : "post",
			dataType : "text",
			data : {roomid : roomid},
			success : function(requestXMLTest) {
			
			document.f1.xintotal.value=requestXMLTest;
			 
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	
	
</script>




